#!/usr/bin/env bash

#step_1
export LANG=zh_CN
#tomcat1日志文件路径
export WEB_TOMCAT1=/usr/local/tomcat1/logs
#tomcat2日志文件路径
export WEB_TOMCAT2=/usr/local/tomcat2/logs
#tomcat3日志文件路径
export WEB_TOMCAT3=/usr/local/tomcat3/logs
echo > ${WEB_TOMCAT1}/catalina.out
echo > ${WEB_TOMCAT2}/catalina.out
echo > ${WEB_TOMCAT3}/catalina.out
find ${WEB_TOMCAT1}/* -mtime +5 -type f -exec rm -f {} \;
find ${WEB_TOMCAT2}/* -mtime +5 -type f -exec rm -f {} \;
find ${WEB_TOMCAT3}/* -mtime +5 -type f -exec rm -f {} \;

#step_2
chmod a+x cleanTomcatlog.sh

#step_3
 crontab -e

#step_4 每天凌晨4：30执行脚本
30 04 * * * /usr/local/script/cleanTomcatlog.sh

#step_5
service crond stop
service crond start









